package cn.iocoder.yudao.hires.mapper;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.hires.entity.ResumeEducationDO;
import cn.iocoder.yudao.hires.vo.ResumeEducationPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 简历-教育经历 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ResumeEducationMapper extends BaseMapperX<ResumeEducationDO> {

    default PageResult<ResumeEducationDO> selectPage(ResumeEducationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResumeEducationDO>()
                .eqIfPresent(ResumeEducationDO::getUserId, reqVO.getUserId())
                .likeIfPresent(ResumeEducationDO::getSchoolName, reqVO.getSchoolName())
                .eqIfPresent(ResumeEducationDO::getSchoolCode, reqVO.getSchoolCode())
                .betweenIfPresent(ResumeEducationDO::getEnrollmentTime, reqVO.getEnrollmentTime())
                .betweenIfPresent(ResumeEducationDO::getDepartureTime, reqVO.getDepartureTime())
                .likeIfPresent(ResumeEducationDO::getSpecializedName, reqVO.getSpecializedName())
                .eqIfPresent(ResumeEducationDO::getSpecializedCode, reqVO.getSpecializedCode())
                .eqIfPresent(ResumeEducationDO::getHighestDegree, reqVO.getHighestDegree())
                .eqIfPresent(ResumeEducationDO::getHighestDegreeCode, reqVO.getHighestDegreeCode())
                .eqIfPresent(ResumeEducationDO::getMajorCourses, reqVO.getMajorCourses())
                .betweenIfPresent(ResumeEducationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ResumeEducationDO::getId));
    }

}